#function: build CentOS7 sshd server
#parmeter:
#author: yeslf
#version: 1.0
#Test:

FROM centos:7
MAINTAINER yeslf yeslf@xxx.com


#install sshd
RUN /usr/bin/mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repobak ;\
/usr/bin/curl  http://mirrors.aliyun.com/repo/epel-7.repo >/etc/yum.repos.d/epel.repo ; \
/usr/bin/curl -o /etc/yum.repos.d/CentOS-Base.repo  http://mirrors.aliyun.com/repo/Centos-7.repo ;\
yum install -y  initscripts  openssh-clients openssh-server ; echo "root:test123"|chpasswd ;\
/usr/bin/mkdir -p /var/lock/subsys/sshd ;  /usr/bin/ssh-keygen  -A ;\
/usr/bin/ssh-keygen  -N "" -f /root/.ssh/id_rsa  -q;cp /root/.ssh/id_rsa.pub /root/.ssh/authorized_keys ;\
chmod 600 /root/.ssh/authorized_keys ; yum clean all 

EXPOSE 22

CMD ["/usr/sbin/sshd","-D"]




